// 饼状图
var dom = document.getElementById("containers");
var myChart = echarts.init(dom);
var option;
myChart.setOption({
	title: {
		text: 'Referer of a Website',
		subtext: 'Fake Data',
		left: 'center'
	},
	tooltip: {
		trigger: 'item'
	},
	legend: {
		orient: 'vertical',
		left: 'left'
	},
	series: [{
		name: 'Access From',
		type: 'pie',
		radius: '50%',
		data: {},
		emphasis: {
			itemStyle: {
				shadowBlur: 10,
				shadowOffsetX: 0,
				shadowColor: 'rgba(0, 0, 0, 0.5)'
			}
		}
	}]
});
option && myChart.setOption(option);
var num = [];
$.ajax({
	url: "http://localhost:8080/Online-student/ClassinfoController/getTeaClassinfoNum",
	type: "get",
	data: {
		tid: 1
	},
	async:false,
	dataType: "json",
	success: function(result) {
		console.log(result);
		if (result.status == 0) {
			// console.log(123);
			$.each(result.data, function(index, item) {
				num.push({
					value: item.num,
					name: item.cname
				})
			})
			console.log(num);
			myChart.setOption({
				series: [{
					data: num
				}]
			})
		}
	}
})